package com.bw.controller;

import com.bw.bean.Car;
import com.bw.service.ServiceCar;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class CarController {
@Resource
    private ServiceCar serviceCar;
//列表
@RequestMapping("/lb")
    public Object lb(){
    List<Car> list = serviceCar.list();
    return list;
    }
    //模糊
    @RequestMapping("/mh")
    public Object mh(){
        List<Car> list = serviceCar.mohu("对");
        return list;
    }
    //精确
    @RequestMapping("/jq")
    public Object jq(){
        List<Car> list = serviceCar.jingq("沪");
        return list;
    }
    //组合
    @RequestMapping("/zh")
    public Object zh(){
        List<Car> list = serviceCar.zuhe("可","");
        return list;
    }
    //添加
    @RequestMapping("/tj")
    public Object tj(){
        int add = serviceCar.add(new Car(0, "端点", "136524785965478545", "13652487548", "京8.8989", "路虎揽胜", 1, null, 2, null, "2004-01-02"));
        return add;
    }
    //删除
    @RequestMapping("/sc")
    public Object sc(){
        int del = serviceCar.del(6);
        return del;
    }
}
